package com.solcoo.controller;

import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.solcoo.dao.ZhangHuDao;
import com.solcoo.dao.ZheKouDao;
import com.solcoo.pojo.ZheKou;
import com.solcoo.service.ZheKouService;

@Controller
public class ZheKouController extends AbstractController {
    @Resource
    private ZheKouDao zheKouDao;
    @Resource
    private ZhangHuDao zhangHuDao;
    @Resource
    private ZheKouService zheKouService;

    // 商户查询折扣
	@RequestMapping(value="shQueryDz.do")
    public @ResponseBody JsonResult shQueryDz(int shanghuid) throws Exception {
		return this.getSuccessJsonResult(zheKouDao.queryListByShid(shanghuid), 0);
    }

    // 商户增加折扣：新增成功后返回最新的折扣列表
	@RequestMapping(value="shAddDz.do")
    public @ResponseBody JsonResult shAddDz(ZheKou zhekou) throws Exception {
        return zheKouService.throwExcepshAddDz(zhekou);
    }
}
